// document ready function
$(document).ready(function() { 	

	//--------------- Data tables ------------------//
	if($('table').hasClass('dynamicTable')){
	 
		$('.dynamicTable').dataTable( {
			"sDom": "<'row-fluid'<'span4 for_filter'f><'span4'T><'span4'l>  r>t<'row-fluid'<'span6'i><'span6'p>>",
			"oTableTools": {
					"sSwfPath": "/resources/theme/supr/plugins/tables/dataTables/swf/copy_csv_xls_pdf.swf",
					"aButtons": [
					"copy",
					"print",
						{
							"sExtends":    "collection",
							"sButtonText": 'Save <span class="caret" />',
							"aButtons":    [ "csv", "xls", "pdf" ]
						}
					]
			},
			"sPaginationType": "bootstrap",
			"bJQueryUI": false,
			"bAutoWidth": false,
			"oLanguage": {
				"sSearch": "<span>Filter:</span> _INPUT_",
				"sLengthMenu": "<span>_MENU_</span>",
				"oPaginate": { "sFirst": "First", "sLast": "Last" }
			}
		});
		$('.dataTables_length select').uniform();
	}

	// Set the classes that TableTools uses to something suitable for Bootstrap
	$.extend( true, $.fn.DataTable.TableTools.classes, {
		"container": "btn-group",
		"buttons": {
			"normal": "btn",
			"disabled": "btn disabled"
		},
		"collection": {
			"container": "DTTT_dropdown dropdown-menu",
			"buttons": {
				"normal": "",
				"disabled": "disabled"
			}
		}
	} );

	// Have the collection use a bootstrap compatible dropdown
	$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
		"collection": {
			"container": "ul",
			"button": "li",
			"liner": "a"
		}
	} );
 });//End document ready functions
